﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PCMSofCC;
using PCMSofCC.BLL;

namespace PCMSofCC.Member
{
    public partial class SubmitAvailableDay : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DateTime startWeek = DateHelper.GetMondayOfThisWeek(DateTime.Now.Date);  //本周周一
            DateTime endWeek = startWeek.AddDays(6);  //本周周日

            litStartDate.Text = startWeek.AddDays(7).ToLongDateString();
            litEndDate.Text = endWeek.AddDays(7).ToLongDateString();
        }

        protected void Submit_Click(object sender, EventArgs e)
        {
            WeekDay flags = WeekDay.None;
            foreach (ListItem item in CheckBoxList1.Items)
            {                
                if (item.Selected)
                    flags |= (WeekDay)Convert.ToInt32(item.Value,16);
            }
            AvailableTime.UpdateTime((Guid)System.Web.Security.Membership.GetUser().ProviderUserKey, flags, DateTime.Now.Date);
        }
    }
}
